﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MyHealthOnline.Dal.Generated.CollectionClasses;
using MyHealthOnline.Dal.Generated.EntityClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;
using MyHealthOnline.Dal.Generated.HelperClasses;

namespace MyHealthOnline.Business
{
    public class MessageBusiness
    {
        public static void AddMessage(DateTime creationDate, string status, string text, bool fromSpecialist, int consultId)
        {
            MessageEntity messageEntity = new MessageEntity();
            messageEntity.CreationDate = creationDate;
            messageEntity.Status=status;
            messageEntity.Text = text;
            messageEntity.FromSpecialist = fromSpecialist;
            messageEntity.ConsultId = consultId;
            messageEntity.Save();
        }

        public static MessageCollection GetMessages()
        {
            MessageCollection messageColl = new MessageCollection();
            messageColl.GetMulti(null);
            return messageColl;
        }
        public static MessageCollection GetMessages(int consultId)
        {
            PredicateExpression filter = new PredicateExpression(MessageFields.ConsultId==consultId);
            MessageCollection messageColl = new MessageCollection();
            messageColl.GetMulti(filter);
            return messageColl;
        }
    
    }
}
